package cn.hahah.module.blog.dal.mysql.userfriend;

import java.util.*;

import cn.hahah.framework.common.pojo.PageResult;
import cn.hahah.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.hahah.framework.mybatis.core.mapper.BaseMapperX;
import cn.hahah.module.blog.dal.dataobject.userfriend.UserFriendDO;
import org.apache.ibatis.annotations.Mapper;
import cn.hahah.module.blog.controller.admin.userfriend.vo.*;

/**
 * 用户好友 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface UserFriendMapper extends BaseMapperX<UserFriendDO> {

    default PageResult<UserFriendDO> selectPage(UserFriendPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UserFriendDO>()
                .eqIfPresent(UserFriendDO::getUserId, reqVO.getUserId())
                .eqIfPresent(UserFriendDO::getFriendId, reqVO.getFriendId())
                .eqIfPresent(UserFriendDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(UserFriendDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(UserFriendDO::getId));
    }

}